package com.huika.lib.ui.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.huika.lib.base.R;

public class MMAlertDialog {
	
	/**
	 * 清楚缓存提示对话框
	 * @param context
	 * @param contentResId
	 * @param leftClick
	 * @param rightClick
	 * @return
	 */
	public static Dialog ClearCacheDialog(final Context context, String contentResId, final View.OnClickListener leftClick, final View.OnClickListener rightClick) {
		final Dialog dlg = new Dialog(context, R.style.IsDelDialog);
		View view = LayoutInflater.from(context).inflate(R.layout.common_no_title_dialog, null); 
		TextView contentTv = (TextView) view.findViewById(R.id.dialog_content_tv);
		contentTv.setText(contentResId);
		Button okBtn = (Button) view.findViewById(R.id.success);
		Button cancel = (Button) view.findViewById(R.id.fail);
		// 确定实名认证
		okBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				dlg.dismiss();
				if (null != rightClick) {
					rightClick.onClick(v);
				}
			}
		});
		cancel.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				dlg.dismiss();
				if (leftClick != null) leftClick.onClick(v);
			}
		});
		dlg.setCanceledOnTouchOutside(true);
		dlg.setContentView(view);
		return dlg;
	}

}
